<!DOCTYPE html>
<html lang="en">
	<head>
		<title>全部预审并发送</title>
        <#include "../inc/header.ftl"/>
    </head>

    <body class="no-skin">

    <div class="main-container ace-save-state" id="main-container">

        <div class="main-content">
            <div class="main-content-inner">

                <div class="page-content">
                    <div class="row">
                        <div class="col-xs-12">
                            <table id="MainGrid"></table>
                            <div id="toolbar">
                                <div style="padding:8px">
                                    日期：<input id="paybankdt" class="easyui-datebox" style="width:140px">&emsp;
                                    <a href="#" onclick="javascript:searchInfo()" class="easyui-linkbutton" iconCls="icon-search">查 询</a>
                                    <a href="#" onclick="javascript:findInfo()" class="easyui-linkbutton" iconCls="icon-redo">全部预审并发送</a>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.row -->
                </div><!-- /.page-content -->

            </div>
        </div><!-- /.main-content -->
    </div><!-- /.main-container -->

    <!-- basic scripts -->
    <#include "../inc/basicjs.ftl"/>

    <!-- inline scripts related to this page -->
    <script type="text/javascript">
        //列表-------------------------------------------------
        jQuery(function($) {
            listPage();
        });
        function searchInfo() {
            listPage(prefix + '/bill/bankcheckbill/findPrereSultsPage',1);
        }
        function listPage(url,mark) {
            if(mark==1){
                var paybankdt = $('#paybankdt').val();
                if(paybankdt==null||paybankdt==''){
                    $.messager.alert('提示', '请选择查询日期', 'info');
                    return;
                }
            }

            // 右侧表格
            $('#MainGrid').datagrid({
                url: url,
                checkbox: true,
                pagination: true,
                striped: true,
                singleSelect: true,
                loadMsg: "正在加载数据，请稍后...",
                queryParams: {paybankdt:paybankdt},
                columns:[[
                    { title: '账号', field: 'accountcode'},
                    { title: '开户行名称', field: 'bankname'},
                    { title: '日期', field: 'paybankdt'},
                    { title: '余额', field: 'balance'},
                    { title: '收入金额', field: 'inamt'},
                    { title: '支出金额', field: 'outamt'},
                    { title: '预审状态', field: 'bankstate',formatter: function(value,row,index){
                        if (value==0){
                            return '成功';
                        } else {
                            return '失败';
                        }
                    }}
                ]],
                toolbar: '#toolbar'
            });

            $(window).resize(function() {
                $('#MainGrid').datagrid('resize');
            });
        }

        function findInfo() {
            var paybankdt = $('#paybankdt').val();
            $.ajax({
                url: prefix + '/bill/bankcheckbill/autocheck1',
                type: 'POST',
                data: {paybankdt:paybankdt},
                dataType: 'json',
                success:function(data){
                    $.messager.alert('提示', data.msg, 'info');
                }
            });
        }

    </script>
    </body>
</html>
